<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>使用v-bind指令-绑定返回对象的计算属性</title>
<!--引入Vue库-->
<script src="vue.js"></script>
<style>
.base {
  font-size: 20px;
  font-weight: bold;
  }
.active {
  color: blue;
  }
.text-danger {
  color: red;
  font-size: 32px;
  }
</style>
</head>
<body>	
<div id="main">
  <div v-bind:class="classObject">
      {{ info }}
  </div>
</div>
<script>
  var vm=new Vue({ 
      el: '#main', 
      data: {
          info:'请登录',
          isActive:true,
          error:{
              value:false,
              type:'fatal'
             }
          },
          computed:{
             classObject: function(){
                return{
                    base:true,
                    active: this.isActive && !this.error.value,
                    'text-danger': this.error.value && this.error.type === 'fatal'
                }
             }
          }
      })
</script>
</body>
</html>